<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<div id="app">
			<home></home>
			<dog></dog>
		</div>
		<!-- 定义home标签 -->
		<template id="homeTem">
			<!-- 在组件中局部组件之间不允许嵌套 -->
			<div>
				<h1>{{name}}</h1>
				<dog></dog>
			</div>
			</template>
			<template id="dogTem">
				<div>
					<h1>{{name}}</h1>
				</div>
			</template>
		<script src="../js/vue.js">	
		</script>
		<script type="text/javascript">
			let dog ={
				data(){
					return{
						name:"点石成金"
					}
				},
				template:"#dogTem"
			}
			// 定义组件的对象
			let home = {
				data(){
					return{
						name:"聚沙成塔"
					}
				},
				// 准备模板标签
				template: "#homeTem",
				// 在home中引用局部组件,必须先声明后引用
				components: {
					dog
				}
			}
			
			const app = new Vue({
				el:"#app",
				components:{
					home,
					dog
				}
			})
			
		</script>
	</body>
</html>
